package edu.udo.sopra10.chaturaji.entities.pieces;

import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableCollection;

import java.util.Collection;

import edu.udo.sopra10.chaturaji.entities.Player;
import edu.udo.sopra10.chaturaji.entities.Square;
import edu.udo.sopra10.chaturaji.entities.coordinates.Movement;

/**
 * A horse is one of the Chaturaji {@link Piece}s. It is worth three points.
 * Players start with a single horse in the left central square of their second
 * row. Horses move exactly two squares into one direction and a single square
 * into the other, jumping over pieces and capturing opposing pieces they land
 * on.
 * 
 * @author Simon Dierl
 */
public final class Horse extends JumpingPiece {
	/**
	 * All movements a horse is theoretically capable of performing.
	 */
	private static final Collection<Movement> MOVEMENTS = unmodifiableCollection(asList(
			new Movement((byte) -2, (byte) -1), new Movement((byte) -2,
					(byte) 1), new Movement((byte) -1, (byte) -2),
			new Movement((byte) -1, (byte) 2),
			new Movement((byte) 1, (byte) -2),
			new Movement((byte) 1, (byte) 2),
			new Movement((byte) 2, (byte) -1), new Movement((byte) 2, (byte) 1)));

	/**
	 * Create a new {@link Horse}.
	 * 
	 * @param owner
	 *            the player owning the horse, must not be {@code null}.
	 * @param square
	 *            the square the horse stands on, may be {@code null} to
	 *            indicate a captured piece.
	 */
	public Horse(final Player owner, final Square square) {
		super(MOVEMENTS, (byte) 3, owner, square);
		this.pieceValue = 30;
	}
}
